<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>canvas 动态绘制</title>
  <style>
    body{
     margin: 0;
     padding: 0;
     position: absolute;
     top: 0;
     left: 0;
     right: 0;
     bottom: 0;
     }
   .container {
     position: relative;
     width: 100%;
     height: 100%;
     display: flex;
     align-items: center;
     justify-content: center;
     flex-direction: column;
   }
   .canvas-container {
     position: relative;
     width: 500px;
     height: 500px;
     padding: 10px;
     border: 2px solid green;
   }
   #canvas {
    position: absolute;
     left: 10px;
     top: 10px;
     right: 10px;
     bottom: 10px;
     width: 500px;
     height: 500px;
     border: 2px solid yellowgreen;
     box-sizing: border-box;
     z-index: 2;
   }
   #imgCanvas {
     position: absolute;
     left: 10px;
     top: 10px;
     right: 10px;
     bottom: 10px;
     z-index: 1;
   }
   #bitmap {
     width: 100%;
     height: 100%;
   }
 </style>
</head>
<body>
  
  <!-- <canvas id="canvas" style="width: 500px; height: 500px;"></canvas> -->
  <div class="container">
    <div style="margin-bottom: 30px;">
      <button onclick="openDraw()">开始标注</button>
      <button onclick="closeDraw()">结束标注</button>
    </div>
    <div class="canvas-container">
      <canvas id="imgCanvas" width="500px" height="500px">
        <img id="bitmap" src="https://img0.baidu.com/it/u=981218435,2998857702&fm=253&app=120&size=w931&n=0&f=JPEG&fmt=auto?sec=1679245200&t=59ba6b7e52a31f41ef2366734aeb6a52" alt="">
      </canvas>
      <canvas id="canvas" width="500px" height="500px"></canvas>
    </div>
  </div>
  <script src="./index.js"></script>
</body>
</html>